<template>
	<view class="new">
		<view class="ul">
			<view class="li" v-for="item in list" :key="item.id" @click="goNewDesails(item.id)">
				<image :src="item.cover_image_url" mode=""></image>
				<view class="text">
					<view class="title">{{item.title}}</view>
					<view class="nr">{{item.description}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: []
			}
		},

		onLoad() {
			uni.request({
				url: '/dpc/v2/pweb/ugc/topics',
				success: (res) => {
					console.log(res)
					this.list = res.data.data.list
				}
			})
		},


		// ifdef APP-PLUS
		onLoad() {
			uni.request({
				url: '/dpc/v2/pweb/ugc/topics',
				success: (res) => {
					console.log(res)
					this.list = res.data.data.list
				}
			})
		},

		//endif

		methods: {
			goNewDesails(id) {
				uni.navigateTo({
					url: '../details/details?id=' + id
				})
			}
		},
		onPullDownRefresh() {
			uni.showToast({
				title: '更新数据中....',
				duration: 1000,
			})

		},
		onReachBottom() {
			uni.showToast({
				title: '加载下一页....',
				duration: 1000
			})
		}
	}
</script>

<style>
	.new {
		padding: 15rpx;
		background-color: #efefef;
	}

	.ul .li {
		margin-bottom: 20rpx;
		background-color: #ffffff;
		padding: 20rpx;
	}

	.ul .li image {
		height: 400upx;
		width: 100%;
	}

	.ul .li .text {
		margin-top: 2%;
		padding: 0 3%;
	}

	.ul .li .text .title {
		font-size: 32rpx;
		color: #333333;
	}

	.ul .li .text .nr {
		font-size: 26rpx;
		color: #9e9e9e;
		margin-top: 2%;
	}
</style>
